package com.robot.backend.controller.pk;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.robot.backend.service.pk.pkHandleService;
@RestController
@RequestMapping("/pkHandle/")
public class pkHandleController {
    @Autowired
    pkHandleService pkHandleService;
    @PostMapping("startGame/")
    public String startGame(@RequestParam MultiValueMap<String,String> map){
        int uid1 = Integer.parseInt(map.getFirst("uid1"));
        int uid2 = Integer.parseInt(map.getFirst("uid2"));
        int winScore = Integer.parseInt(map.getFirst("winScore"));
        int loseScore = Integer.parseInt(map.getFirst("loseScore"));
        return pkHandleService.startGame(uid1,uid2,winScore,loseScore);
    }
}
